package com.cskaoyan.controller.stage;

import com.cskaoyan.model.vo.*;
import com.cskaoyan.service.TopicService;
import com.cskaoyan.service.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.crypto.Data;

/**
 * @ClassName: WxTopicController
 * @Description: 专题控制层
 * @Author:YPS
 * @Date: 2022/5/9 17:08
 * @Version: 1.0
 **/
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {
    @Autowired
    WxTopicService wxTopicService;
    @Autowired
    TopicService topicService;
    @RequestMapping("list")
    public BaseRespVO<DataVO<WxTopicListVO>> getTopicList(Integer page, Integer limit){
        DataVO<WxTopicListVO> dataVO = wxTopicService.getTopicList(page, limit);
        return BaseRespVO.ok(dataVO);
    }

    @RequestMapping("detail")
    public BaseRespVO<TopicReadVO> getTopicDetails(Integer id){
        TopicReadVO topicDetails = topicService.readTopic(id);
        return BaseRespVO.ok(topicDetails);
    }

    @RequestMapping("related")
    public BaseRespVO<DataVO<TopicTopicVO>> getTopicRelated(Integer id){
        DataVO<TopicTopicVO> topicVODataVO = wxTopicService.getTopicRelated(id);
        return BaseRespVO.ok(topicVODataVO);
    }

}
